﻿

<extend name="Common/public"/>

<block name="content">
<title>添加用户</title>
</head>
<body>
<div class="pd-20">
  <form action="" method="post" class="form form-horizontal" id="form-member-add">
    <div class="row cl">
    	<label class="form-label col-3">商品分类：</label>
      <div class="formControls col-5"> <span class="select-box">
        <select class="select" size="1" name="cat_id">
          <option value="0" selected>请选择分类</option>
          <volist name="cats" id="v">
          <option value="{$v['id']}" <if condition="$goods['cat_id'] == $v['id']">selected</if>>{:str_repeat('　',$v['C_count'])}{$v['cat_name']}</option>
          </volist>
        </select>
        </span> </div>
      <div class="col-4"> </div>
    </div>
    <div class="row cl">
      <label class="form-label col-3"><span class="c-red">*</span>商品名称：</label>
      <div class="formControls col-5">
        <input type="text" class="input-text" value="{$goods['goods_name']}" placeholder="" id="member-name" name="goods_name" >
      </div>
      <div class="col-4"> </div>
    </div>
    <div class="row cl">
      <label class="form-label col-3">商品品牌：</label>
      <div class="formControls col-5"> <span class="select-box">
        <select class="select" size="1" name="goods_brand">
          <option value="0" selected>请选择品牌</option>
          <volist name="brands" id="v">
          <option value="{$v['id']}" <if condition="$goods['goods_brand'] == $v['id']">selected</if>>{$v['brand_name']}</option>
          </volist>
        </select>
        </span> </div>
      <div class="col-4"> </div>
    </div>
    <div class="row cl">
      <label class="form-label col-3">市场价格：</label>
      <div class="formControls col-5">
        <input type="text" class="input-text" value="<empty name="goods">0.00<else/>{$goods['market_price']}</empty>" placeholder="" id="member-tel" name="market_price">
      </div>
      <div class="col-4"> </div>
    </div>
     <div class="row cl">
      <label class="form-label col-3"><span class="c-red">*</span>本店价格：</label>
      <div class="formControls col-5">
        <input type="text" class="input-text" value="<empty name="goods">0.00<else/>{$goods['shop_price']}</empty>" placeholder="" id="member-tel" name="shop_price"  datatype="*" nullmsg="价格不能为空">
      </div>
      <div class="col-4"> </div>
    </div>
    <div class="row cl">
      <label class="form-label col-3"><span class="c-red">*</span>是否上架：</label>
      <div class="formControls col-5 skin-minimal">
        <div class="radio-box">
          <input type="radio" id="sex-1" name="is_on_sale" value="1" <empty name="goods">checked</empty> <if condition="$goods['is_on_sale'] == 1">checked</if>>
          <label for="sex-1">是</label>
        </div>
        <div class="radio-box">
          <input type="radio" id="sex-2" name="is_on_sale" value="0" <if condition="$goods['is_on_sale'] == 0 && isset($goods)">checked</if>>
          <label for="sex-2">否</label>
        </div>
      </div>
      <div class="col-4"> </div>
    </div>
    
   	<div class="row cl">
      <label class="form-label col-3">商品库存：</label>
      <div class="formControls col-5">
        <input type="text" class="input-text" value="{$goods['goods_count']}" placeholder="" id="member-tel" name="goods_count">
      </div>
      <div class="col-4"> </div>
    </div>
    	<div class="row cl">
		<label class="form-label col-3">商品描述：</label>
		<div class="formControls col-5"> 
			<textarea class="textarea" name="goods_desc">{$goods['goods_desc']}</textarea>
		</div>
	</div>
   	<div class="row cl">
		<label class="form-label col-3">商品介绍：</label>
		<div class="formControls col-8"> 
			<script name="goods_into" id="editor" type="text/plain" style="width:100%;height:400px;">{$goods['goods_into']|htmlspecialchars_decode}</script> 
		</div>
	</div>
	<notempty name="goods">
		<input type="hidden" value='{$goods['id']}' name='goods_id'/>
	</notempty>
    <div class="row cl">
      <div class="col-9 col-offset-3">
        <input class="btn btn-primary radius" type="submit" value="&nbsp;&nbsp;提交&nbsp;&nbsp;">
      </div>
    </div>
  </form>
</div>
</div>
<include file="Common/js"/>
<script type="text/javascript" src="__PUBLIC__lib/ueditor/1.4.3/ueditor.config.js"></script> 
<script type="text/javascript" src="__PUBLIC__lib/ueditor/1.4.3/ueditor.all.min.js"> </script> 
<script type="text/javascript" src="__PUBLIC__lib/ueditor/1.4.3/lang/zh-cn/zh-cn.js"></script> 
<script type="text/javascript">
$(function(){
	$('.skin-minimal input').iCheck({
		checkboxClass: 'icheckbox-blue',
		radioClass: 'iradio-blue',
		increaseArea: '20%'
	});
	
	$("#form-member-add").Validform({
		tiptype:2,
		ajaxPost:true,
		callback:function(data){
			$.Hidemsg();
			if(data.status == 'y'){
				layer.msg('成功',{icon:6,time:1000});
				setTimeout(function(){
					var index = parent.layer.getFrameIndex(window.name);
					parent.location.reload();
					parent.layer.close(index);
				},1000);
			}else{
				layer.msg(data.msg,{icon:5,time:1000});	
			}
		}
	});
	
	var ue = UE.getEditor('editor');
});
</script>
</body>
</block>